package com.mofang.activity.housesource;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.mofang.R;
import com.mofang.activity.BaseTitleViewActiviey;
import com.mofang.adapters.NewHouseAdapter;
import com.mofang.utils.ListHeightUtils;

public class NewHouseActivity extends BaseTitleViewActiviey implements
		OnClickListener {

	private LinearLayout area_ly;// 区域
	private LinearLayout type_ly;// 类型
	private LinearLayout price_ly;// 价格
	private LinearLayout sort_ly;// 排序

	private NewHouseAdapter adapter;
	private ListView new_house_list;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.activity_new_house);
		super.onCreate(savedInstanceState);
		setNavigationLeftBtnImage(R.drawable.return_arrow);

		initPassedData();

		initView();

	}

	private void initPassedData() {

		// int houseTag = getIntent().getIntExtra("newHouseTag", 0);

		if (getIntent().getIntExtra("newHouseTag", 0) == 1) {
			setNavigationTitle("新房");
		} else if (getIntent().getIntExtra("secondHandHouseTag", 0) == 2) {
			setNavigationTitle("二手房");
		} else if (getIntent().getIntExtra("rentalTag", 0) == 3) {
			setNavigationTitle("租凭");
		} else if (getIntent().getIntExtra("privateOrderingTag", 0) == 4) {
			setNavigationTitle("私人订制");
		}

	}

	protected void initView() {

		area_ly = (LinearLayout) findViewById(R.id.new_house_area_ly);
		area_ly.setOnClickListener(this);

		type_ly = (LinearLayout) findViewById(R.id.new_house_type_ly);
		type_ly.setOnClickListener(this);

		price_ly = (LinearLayout) findViewById(R.id.new_house_price_ly);
		price_ly.setOnClickListener(this);

		sort_ly = (LinearLayout) findViewById(R.id.new_house_sort_ly);
		sort_ly.setOnClickListener(this);

		adapter = new NewHouseAdapter(getApplicationContext());
		new_house_list = (ListView) findViewById(R.id.new_house_list);
		new_house_list.setAdapter(adapter);
		ListHeightUtils.setListViewHeightBasedOnChildren(new_house_list);

	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		Intent intent;
		switch (v.getId()) {

		case R.id.new_house_area_ly:

			break;
		case R.id.new_house_type_ly:

			break;
		case R.id.new_house_price_ly:

			break;
		case R.id.new_house_sort_ly:

			break;

		default:
			break;
		}
	}

}
